<template>
  <div class="story-nav">

    <div
      class="story-nav_group"
      v-for="(group, index) in getRoutes()[0]['children']"
      :key="index"
    >
      
      <template v-if="group.children && group.children.length">
        <div class="story-nav_title">{{ group.name }}</div>
        <div
          v-for="(item, groupIndex) in group.children"
          :key="groupIndex"
          class="story-nav_item"
        >
            <NavItem :title="item.name" :to="item.path"></NavItem> 
        </div>
      </template>
      <template v-else>
        <div class="story-nav_item">
 <NavItem  v-if="group.name" :title="group.name" :to="group.path"></NavItem>
        </div>
       
      </template>
    </div>
  </div>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { getRoutes } from "../router";
import NavItem from './NavItem.vue';
export default defineComponent({
  name: "StoryNav",
  components:{
     NavItem
  },
  setup() {
    return {
      getRoutes,
    };
  },
});
</script>

<style lang="scss" scoped>
@import "../common/style/_var.scss";
.story-nav {
  position: fixed;
  left: 0;
  bottom: 0;
  top: $header-height;
  z-index: 1;
  min-width: $nav-width;
  max-width: $nav-width;
  padding: $story-padding 0;
  overflow-y: scroll;
  background-color: #fff;
  box-shadow: 0 8px 12px #ebedf0;

  .story-nav_title {
    padding: 8px 0 8px 16px;
    color: #455a64;
    font-weight: 600;
    font-size: 15px;
    line-height: 20px;
  }
 
}
</style>